<?php

/**
 * @author Edson5
 * @copyright 2011
 */
 
 //$ch=$_GET['c1'];
 //$ch2=$_GET['c2'];
 //$codt=$_GET['ct'];
 //$codigotourtrack=$_GET['ctt'];

$ruta=$_SERVER['DOCUMENT_ROOT']."/viventura/MDHoteles";
$ruta2=$_SERVER['DOCUMENT_ROOT']."/viventura";




include_once("$ruta/conf/CConfig.php");


if($_POST['state']==1)
{
 $sim=$_POST['si'];
 $do=$_POST['dob'];
 $mat=$_POST['ma'];
 $codigo=$_POST['codt'];
 $codigoHotel=$_POST['idH'];
$query2="UPDATE tour_as SET bloq = '1' ,simpHot='$sim',dobHot='$do',matHot='$mat' WHERE tour_idTour =$codigo and hoteles_idHot=$codigoHotel";    
CModelo::getInstance()->updateData($query2);    

}elseif($_POST['state']==2)
{
    $codigo=$_POST['codt'];
    $codigohotel=$_POST['idH'];
    $idgen=$_POST['id_gen'];
    $query2="select * from tour_as where tour_idTour=$codigo and hoteles_idHot=$codigohotel";
    $data=CModelo::getInstance()->getData($query2);
    ?>
    <form  action="#" method="post">
        <input  id="cod<?php echo $codigohotel;?>" type="hidden" value=<?php echo $codigohotel;?> />
        <input id="codtour<?php echo $codigohotel;?>" type="hidden" value='<?php echo $codigo;?>'/>
        
        <p>
        "Simple"<br>
        <input id="simple<?php echo $codigohotel;?>" name='simple' value='<?php echo $data[0]['simpHot'];?>'/>
        <br >
        "Doble"<br>
         
        <input id="Doble<?php echo $codigohotel;?>" name='doble' value='<?php echo $data[0]['dobHot'];?>'/>
        <br>
        "Matrimonial"</br>
        <input  id="Matrimonial<?php echo $codigohotel;?>" name='matrimonial' value='<?php echo $data[0]['matHot'];?>'/>
        <br >
        </p>
        
        <p>
        <a href="#" onclick=sendConf('<?php echo $idgen;?>','<?php echo $codigohotel;?>')><input type="button" name="widgeta" class="submit_button" value="Confirmar"/>
        </a> 
        </p>      
        
        </form>
    <?php
    
}
elseif($_POST['state']==3)
{
 $sim=$_POST['si'];
 $do=$_POST['dob'];
 $mat=$_POST['ma'];
 $codigo=$_POST['codt'];
 $codigoHotel=$_POST['idH'];
 $query2="UPDATE tour_as SET conf = '1' ,simpHot='$sim',dobHot='$do',matHot='$mat' WHERE tour_idTour =$codigo and hoteles_idHot=$codigoHotel";    
 CModelo::getInstance()->updateData($query2); 
    
}
//$query="insert into tour_as (tour_idTour,hoteles_idHot,bloq,conf) values ('$codt','$codigo','$ch','$ch2')";

 //CModelo::getInstance()->insertData($query);





//echo $_SERVER['HTTP_REFERER'];
?>
<!--<script type="text/javascript">
//alert("Cambios Realizados");
//setTimeout('history.go(-2)',100);
</script>
-->
